//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Windows.Controls.Primitives;
using System.Windows.Controls;

namespace OpenLS.Spreadsheet.UI
{
    public class DragSideDeltaEventArgs : DragDeltaEventArgs
    {
        public DragSideDeltaEventArgs(double horizontalChange, double verticalChange, Dock dragSide)
            : base(horizontalChange, verticalChange)
        {
            DragSide = dragSide;
            RoutedEvent = ResizeAdorner.DragSideDeltaEvent;
        }
        protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget)
        {
            DragSideDeltaEventHandler handler = (DragSideDeltaEventHandler)genericHandler;
            handler(genericTarget, this);
        }

        public Dock DragSide { get; set; }
        public double Amount
        {
            get
            {
                switch (DragSide)
                {
                    case Dock.Top:
                    case Dock.Bottom:
                        return VerticalChange;
                    case Dock.Right:
                    case Dock.Left:
                        return
                        HorizontalChange;
                    default: throw new NotSupportedException();
                }
            }
        }
    }
    public delegate void DragSideDeltaEventHandler(object sender, DragSideDeltaEventArgs args);
}
